﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MyVoteMVC.Models
{
    public class Item
    {
        /// <summary>
        /// PK Guid
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// FK 选项所属问题ID
        /// </summary>
        public string QID { get; set; }

        public string QuestionTitle { get; set; }

        /// <summary>
        /// FK 选项所属项目ID
        /// </summary>
        public string PID { get; set; }

        public string PYear { get; set; }
        public string PAddress { get; set; }
        public string pName { get; set; }
        public string pType { get; set; }
        public string pAwards { get; set; }
        public string pDescription { get; set; }

        /// <summary>
        /// 选项自编号
        /// </summary>
        public int? No { get; set; }

        /// <summary>
        /// 选项标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 选项描述
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 是否默认选中
        /// </summary>
        public int? IfDefault { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string Created_By { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? Created_Date { get; set; }

        /// <summary>
        /// 创建方法
        /// </summary>
        public string Created_Action { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        public string Last_Update_By { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? Last_Update_Date { get; set; }

        /// <summary>
        /// 更新方法
        /// </summary>
        public string Last_Update_Action { get; set; }

        /// <summary>
        /// 选项在线票数计数
        /// </summary>
        public int? Online_Count { get; set; }

        /// <summary>
        /// 选项离线票数计数
        /// </summary>
        public int? Offline_Count { get; set; }

        //LazyLoad
        /// <summary>
        /// 选项相关问题
        /// </summary>
        public virtual Question Question { get; set; }

        /// <summary>
        /// 选项相关图片
        /// </summary>
        public virtual ItemImage ItemImage { get; set; }

        /// <summary>
        /// 选中的项目
        /// </summary>
        public virtual Project Project { get; set; }
    }

    public class ItemImage
    {
        public ItemImage()
        {
             
        }
        [Key]
        /// <summary>
        /// PK Guid
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 选项图片
        /// </summary>
        public byte[] Image { get; set; }
    }
}
